package cn.edu.wynu.aspect;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class LogAopAspectConfigClass {

    /**
     * 在切点表达式"execution(public void cn.edu.wynu.*Handler.*(..))"指向的方法前执行该函数（通知）
     */
    @Before(value = "execution(public void cn.edu.wynu.pojo.*Handler.*(..))")
    public void dealAddLog() {
        System.out.println("前置函数");
    }

    @AfterThrowing("execution(public void cn.edu.wynu.pojo.*.*(..))")
    public void dealExceptionLog() {
        System.out.println("发生异常了！");
    }

    @AfterReturning("execution(public void cn.edu.wynu.pojo.*Handler.*(..))")
    public void dealAfterReturnAddLog() {
        System.out.println("后置函数");
    }
}
